#ifndef SETSERIALPARAM_H
#define SETSERIALPARAM_H

#include <QWidget>
#include <QComboBox>
#include <QLabel>
#include <QSettings>
#include <qt_windows.h>
#include <QMessageBox>
#include <QDebug>
#include <QPushButton>

#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>




typedef struct _SERIAL_SET_PARAM
{
    QString serial_port_name;
    QSerialPort::BaudRate           m_serial_param_baud     ;
    QSerialPort::StopBits           m_serial_param_stop_bit ;
    QSerialPort::DataBits           m_serial_param_data_bit ;
    QSerialPort::Parity             m_serial_param_check_bit;

}SERIAL_SET_PARAM;

class SetSerialParam : public QWidget
{
    Q_OBJECT
public:
    explicit SetSerialParam(QWidget *parent = nullptr,SERIAL_SET_PARAM *p = nullptr);







signals:
    void serial_open_signal();
    void serial_close_signal();

public slots:
    void serial_open_btn_handle();

private:
    QStringList get_enable_serial_port();
    QString get_comm(int nIndex, bool bValue = true);
private:
   QComboBox *  serial_port_combox              = nullptr;
   QComboBox *  serial_baud_combox              = nullptr;
   QComboBox *  serial_stop_bit_combox          = nullptr;
   QComboBox *  serial_data_bit_combox          = nullptr;
   QComboBox *  serial_odd_even_check_combox    = nullptr;
   SERIAL_SET_PARAM *_serial_set_param          =  nullptr;

   QPushButton * serial_open_btn = nullptr;
   bool serial_open;
public:
   void  get_serial_param();



};

#endif // SETSERIALPARAM_H
